﻿@model RotaractProjectCalendar.ViewModels.CoordinatorIndexData

@{
    ViewBag.Title = "Koordynatorzy";
}

<h2>Koordynatorzy</h2>

<p>
    @Html.ActionLink("Dodaj koordynatora", "Create")
</p>

<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.Coordinators.FirstOrDefault().Club.ClubTitle)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Coordinators.FirstOrDefault().Name)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Coordinators.FirstOrDefault().PhoneNumber)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Coordinators.FirstOrDefault().CoordinatorEmailAddress)
        </th>
        <th></th>
    </tr>

    @foreach(var item in Model.Coordinators)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Club.ClubTitle)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.PhoneNumber)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.CoordinatorEmailAddress)
            </td>
            <td>
                @Html.ActionLink("Wybierz", "Index", new { id = item.Id }) |
                @Html.ActionLink("Edytuj", "Edit", new { id = item.Id }) |
                @Html.ActionLink("Szczegóły", "Details", new { id = item.Id }) |
                @Html.ActionLink("Usuń", "Delete", new { id = item.Id })
            </td>
        </tr>
    }

</table>

@if(Model.Projects != null)
{
    <h3>Projekty organizowane przez koordynatora</h3>

    <table class="table">
        <tr>
            <th></th>
            <th>
                @Html.DisplayNameFor(model => model.Projects.FirstOrDefault().StartDateTime)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Projects.FirstOrDefault().ProjectTitle)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Projects.FirstOrDefault().Location)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Projects.FirstOrDefault().City.CityName)
            </th>
        </tr>
        @foreach(var item in Model.Projects)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.StartDateTime)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.ProjectTitle)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Location)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.City.CityName)
                </td>
            </tr>
        }

    </table>
}